package com.mycloud.message;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created by PC on 2019/1/12.
 */
@Component
@Slf4j
public class MqReceiver {

//  1.  @RabbitListener(queues = "myQueue")
//  2.自动创建队 @RabbitListener(queuesToDeclare = @Queue("myQueue"))
//  3.自动创建 Exchange和Queue绑定
  /*  @RabbitListener(bindings = @QueueBinding(
            value =  @Queue("myQueue"),
            exchange = @Exchange("myExchange")
    ))
    public void process(String message) {
        log.info("MqReceiver:{}", message);
    }


    *//**
     * 数码供应商服务
     * @param message
     *//*
    @RabbitListener(bindings = @QueueBinding(
            value =  @Queue("computerOrder"),
            exchange = @Exchange("myOrder"),
            key = "computer"
    ))
    public void orderProcess(String message) {
        log.info("MqReceiver:{}", message);
    }


    @RabbitListener(bindings = @QueueBinding(
            value =  @Queue("fruitOrder"),
            exchange = @Exchange("myOrder"),
            key = "fruit"
    ))
    public void fruitProcess(String message) {
        log.info("MqReceiver:{}", message);
    }
*/
}
